﻿<UserControl x:Class="GiveAQuiz.QuizManager.Views.ToolbarView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="400">

  <Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
      <RowDefinition Height="43.25" />
      <RowDefinition />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="22" />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Button x:Name="copyButton"
            Command="{Binding AddQuestionCommand}"
            CommandParameter="{Binding SelectedItem, ElementName=questionList}"
            ToolTipService.ToolTip="Add Question to Quiz"
            HorizontalAlignment="Left"
            VerticalContentAlignment="Center"
            HorizontalContentAlignment="Center"
            d:LayoutOverrides="VerticalAlignment"
            Style="{StaticResource ImageButton}">
      <Button.Content>
        <Image Source="/GiveAQuiz.Common;component/images/add.png" />
      </Button.Content>
    </Button>
    <ListBox x:Name="questionList"
             ItemsSource="{Binding ToolbarItems}"
             Margin="8"
             Grid.RowSpan="2"
             Grid.Column="1">
      <ListBox.ItemTemplate>
        <DataTemplate>
          <!-- Using a XAML event handler since its in the Template -->
          <StackPanel Width="220"
                      Margin="4"
                      Loaded="StackPanel_Loaded">
            <TextBlock Text="{Binding DisplayName}" />
            <Border Style="{StaticResource standardBorder}">
              <ContentControl Content="{Binding Thumbnail}" />
            </Border>
          </StackPanel>
        </DataTemplate>
      </ListBox.ItemTemplate>
    </ListBox>
  </Grid>
</UserControl>
